<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  -->

<div fxFlex="100" fxLayout="row" fxLayoutAlign="start center">
    <button
        mat-button
        mat-raised-button
        color="accent"
        matTooltip="Save Pipeline"
        [matTooltipPosition]="'above'"
        [disabled]="!pipelineValidationService.pipelineValid"
        (click)="savePipelineEmitter.emit()"
        type="submit"
        data-cy="sp-editor-save-pipeline"
    >
        <div fxLayoutAlign="start center" fxLayout="row">
            <i class="material-icons">save</i>
            <span>&nbsp;Save pipeline</span>
        </div>
    </button>
    <span class="assembly-options-divider"></span>
    <button
        mat-button
        color="accent"
        matTooltip="Data Preview"
        matTooltipPosition="above"
        (click)="togglePreviewEmitter.emit()"
        [disabled]="isPipelineAssemblyEmpty()"
    >
        <div fxLayoutAlign="start center" fxLayout="row">
            <i class="material-icons">visibility</i>
            <span *ngIf="!previewModeActive">&nbsp;Enable live preview</span>
            <span *ngIf="previewModeActive">&nbsp;Disable live preview</span>
        </div>
    </button>
    <span class="assembly-options-divider"></span>
    <button
        mat-button
        color="accent"
        matTooltip="Auto Layout"
        [matTooltipPosition]="'above'"
        (click)="autoLayout()"
    >
        <i class="material-icons">settings_overscan</i>
        <span>&nbsp;Auto Layout</span>
    </button>
    <span class="assembly-options-divider"></span>
    <button
        color="accent"
        mat-button
        matTooltip="Add pipeline element"
        [matTooltipPosition]="'above'"
        (click)="openDiscoverDialog()"
        data-cy="sp-editor-add-pipeline-element"
    >
        <i class="material-icons">add</i>
        <span>&nbsp;Add element</span>
    </button>
    <button
        color="accent"
        mat-button
        matTooltip="Add template"
        [matTooltipPosition]="'above'"
        (click)="openAddTemplateDialog()"
        data-cy="sp-editor-add-template"
    >
        <i class="material-icons">add</i>
        <span>&nbsp;Add template</span>
    </button>
    <sp-pipeline-assembly-options-pipeline-cache
        [rawPipelineModel]="rawPipelineModel"
        [pipelineCanvasMetadata]="pipelineCanvasMetadata"
        #assemblyOptionsPipelineCacheComponent
    >
    </sp-pipeline-assembly-options-pipeline-cache>
    <span fxFlex></span>
    <button
        color="accent"
        mat-icon-button
        matTooltip="Clear Assembly Area"
        [matTooltipPosition]="'above'"
        [disabled]="editorService.pipelineAssemblyEmpty"
        (click)="showClearAssemblyConfirmDialog($event)"
        data-cy="clear-assembly-area"
    >
        <i class="material-icons">clear</i>
    </button>
</div>
